<template>
  <el-row :gutter="20" class="label-span">
    <el-col :xs="24" :sm="col" v-for="(item,index) in field_list" :key="index">
      <label>{{item.fieldName}}：</label>
      <span v-if="item.fieldType == '8'">
        <el-image 
          style="height: 18px;width:18px;float:left;"
          :src="item.fieldValue" 
          :preview-src-list="[item.fieldValue]">
        </el-image>
      </span>
      <span v-else-if="item.fieldType == '9'">
        <el-link type="primary"  @click="$util.winOpen(item.fieldValue)">点击查看</el-link>
      </span>
      <span v-else>{{item.fieldValue}} 
        <i class="el-icon-refresh-right cursor c-blue" title="查看变更" v-if="item.historyValue" @click="showChange(item)"></i>
      </span>
    </el-col>
    <el-dialog
      :title="'更新时间：'+updateTime"
      :visible.sync="change.is_show"
      :close-on-click-modal="false"
      class="dialog-form"
      width="600px"
      :show-close="false"
      append-to-body
    >
      <el-row class="label-span">
        <el-col :span="24"><label>字段名：</label><span>{{change.row.fieldName}}</span></el-col>
        <el-col :span="24"><label>原值：</label><span>{{change.row.historyValue}}</span></el-col>
        <el-col :span="24"><label>变值：</label><span>{{change.row.fieldValue}}</span></el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="change.is_show = false">返回</el-button>
      </div>
    </el-dialog>
  </el-row>
</template>

<script>
export default {
  props:{
    list: {
      type: Array,
    },
    updateTime:{
      type: String,
    },
    col: {
      type: Number,
      default: () => 8,
    }
  },
  data(){
    return{
      change:{
        is_show: false,
        title: null,
        row: {},
      }
    }
  },
  computed:{
    field_list(){
      return this.list
    }
  },
  methods:{
    showChange(row){
      this.change.is_show = true;
      this.change.row = row;
    }
  }
}
</script>

<style>

</style>